home *** CD-ROM | disk | FTP | other *** search
/ Precision Software Appli…tions Silver Collection 1 / Precision Software Applications Silver Collection Volume One (PSM) (1993).iso / windows / games / bjack1.exe / WKSTA.BAS < prev   
BASIC Source File  |  1991-11-19  |  3KB  |  68 lines

  1.  
  2. Function LMNetWkstaGetInfo_L10% (Server$, VB_WkstaInfo As wksta_info_10)
  3.  
  4. ' Wrapper:  LMNetWkstaGetInfo_L10
  5. '    File:  WKSTA.BAS
  6. ' Purpose:  Returns information about the configuration
  7. '           elements for a workstation.
  8.  
  9. '   Data Structure:  wksta_info_10
  10. '            Level:  10
  11. ' Associated Files:  WKSTA.TXT
  12.  
  13. ' Parameters:  Server - the name of the server on which to execute the
  14. '                       command. A NULL string specifies the local computer.
  15.  
  16. '              VB_WkstaInfo - wksta_info structure in which to store the
  17. '                       returned data.
  18.  
  19.  
  20. ' Variables used in the NetWkstaGetInfo API call
  21.     Dim Level As Integer                        ' information level
  22.     Dim BufferPointer As Long                   ' pointer to LM buffer
  23.     Dim BufferSize As Integer                   ' buffer size
  24.     Dim TotalBytesAvail As Integer              ' total bytes available
  25.  
  26. ' Other variables
  27.     Dim result As Integer          ' return value for API call
  28.  
  29.                                                                
  30.     Level = 10  ' designates information level, cannot just change this
  31.                 ' value to change info level - structure name and constant
  32.                 ' name must also be changed (wksta_info_10 and
  33.                 ' FMT_wksta_info_10).  The function name
  34.                 ' (LMNetWkstaGetInfo_L10) should also be changed.
  35.  
  36. ' Create LM buffer and get size in BufferSize
  37.     BufferPointer = CreateLMBuffer(FMT_wksta_info_10, 1, BufferSize)
  38.  
  39.     If BufferPointer = 0& Then      ' error, unable to allocate buffer
  40.         LMNetWkstaGetInfo_L10 = -1
  41.         Exit Function
  42.     End If
  43.  
  44. ' Call LM API function NetWkstaGetInfo to get data
  45.     result = NetWkstaGetInfo(Server, Level, BufferPointer, BufferSize, TotalBytesAvail)
  46.  
  47. ' check for error return
  48.  
  49.     If result <> NERR_Success Then       ' error occurred
  50.         LMNetWkstaGetInfo_L10 = result          ' set return for function
  51.         result = FreeLMBuffer(BufferPointer)    ' free LM buffer
  52.         Exit Function
  53.     End If
  54.  
  55. ' Copy data from LM buffer to wksta_info structure
  56.     result = BufferToVBType(VB_WkstaInfo, Len(VB_WkstaInfo), BufferPointer, BufferSize, FMT_wksta_info_10)
  57.     
  58. ' check if error
  59.     If result = NERR_Success Then    ' return OK
  60.         LMNetWkstaGetInfo_L10 = FreeLMBuffer(BufferPointer)  ' free memory for LM buffer
  61.     Else                ' error occurred, set return value
  62.         LMNetWkstaGetInfo_L10 = result
  63.         result = FreeLMBuffer(BufferPointer)  ' free memory for LM buffer
  64.     End If
  65.  
  66. End Function
  67.  
  68.